<?php

namespace yak\layui\widgets\navbar;

use yii\helpers\Html;

/**
 * Class Avatar
 * @package yak\layui\widgets\navbar
 */
class Avatar implements CustomerElement
{
    public function render($data, $href, $options)
    {
        // TODO: Implement render() method.
        if (\Yii::$app->user->isGuest) {
            $title = Html::img('http://t.cn/RCzsdCq', ['class' => 'layui-nav-img']) . '游客';
        } else {
            $title = Html::img('http://t.cn/RCzsdCq', ['class' => 'layui-nav-img']) . \Yii::$app->user->identity->name;
        }
        
        return Html::a($title, $href, $options);
    }
}